// SWERC 2009 UVa12206, Stammering Aliens
// 刘汝佳
#include <bits/stdc++.h>
using namespace std;
#define _for(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long LL;
typedef unsigned long long ULL;
const int MAXN = 40000 + 8;
const ULL x = 123;
ULL H[MAXN], PX[MAXN], Hash[MAXN];
int N, sa[MAXN];
void init_PX() {  // 初始化Hash计算所用的x^p
  PX[0] = 1;
  _for(i, 1, MAXN) PX[i] = x * PX[i - 1];
}
void init_hash(const string& s) {
  N = s.length();
  H[N] = 0;
  for (int i = N - 1; i >= 0; i--) H[i] = (s[i] - 'a' + 1) + H[i + 1] * x;
}
bool ok(int L, int M, int& pos) {  // 是否有长度至少len的子串出现M次以上
  _for(i, 0, N - L + 1) sa[i] = i, Hash[i] = H[i] - H[i + L] * PX[L];
  unordered_map<ULL, int> C;
  pos = -1;
  _for(i, 0, N - L + 1) {
    Hash[i] = H[i] - H[i + L] * PX[L];
    if (++C[Hash[i]] >= M) pos = i;
  }
  return pos >= 0;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  init_PX();
  string word;
  for (int t = 0, pos, M; cin >> M >> word && M; t++) {
    init_hash(word);
    if (!ok(1, M, pos)) {
      puts("none");
      continue;
    }
    int l = 1, r = N + 1;
    while (l + 1 < r) {
      int m = l + (r - l) / 2;
      if (ok(m, M, pos))
        l = m;
      else
        r = m;
    }
    ok(l, M, pos);
    printf("%d %d\n", l, pos);
  }
  return 0;
}

/*
算法分析请参考: 《入门经典训练指南-升级版》3.4.3节 例题20
注意在二分查找之前要首先判断问题是否有解
*/
// Accepted 880ms 1613 C++ 5.3.0 2020-12-14 13:07:48 25845792